from tortoise import fields
from app.models.base.base import BaseModel

class AIProject(BaseModel):
    """AI项目推荐模型"""
    name = fields.CharField(max_length=100, description="项目名称")
    type = fields.CharField(max_length=50, description="项目类型")  # ml, dl, nlp, cv, speech, recommendation
    difficulty = fields.IntField(description="难度等级 1-入门 2-中级 3-高级")
    description = fields.TextField(null=True, description="项目描述")
    github_url = fields.CharField(max_length=255, null=True, description="GitHub链接")
    demo_url = fields.CharField(max_length=255, null=True, description="演示链接")
    technologies = fields.TextField(null=True, description="技术栈")
    tags = fields.TextField(null=True, description="标签")
    stars = fields.IntField(default=0, description="收藏数")
    views = fields.IntField(default=0, description="浏览量")
    
    # 关联字段
    user = fields.ForeignKeyField('models.User', related_name='ai_projects')
    
    class Meta:
        table = "ai_projects"
        table_description = "家庭AI项目推荐表"